---
- name: Install nginx via apt
  ansible.builtin.apt:
    name: nginx
    state: latest
    update-cache: true
- name: Add my_domain
  template:
    src: templates/my_domain
    dest: /etc/nginx/sites-enabled/my_domain
    owner: "{{ ansible_user }}"
    group: "{{ ansible_user }}"
- name: Delete default setting
  file:
    path: /etc/nginx/sites-enabled/default
    state: absent
- name: Starting nginx
  service:
   name: nginx
   state: restarted